<style type="text/css" media="screen">
	
	#divWizardList {float:left; width:750px;}
	#divCart {float:right;}
	.step {float:left; margin-bottom: 10px; width:750px; }
	.step_content {float:left; margin-bottom: 10px; }
	.step_title {float:left; margin-bottom: 5px; margin-left: 20px;}
	.category { float:left; cursor: pointer; margin-right: 5px; }

	.cell  { border: 2px white solid; float:left; cursor: pointer; margin-right: 3px; margin-bottom: 10px; z-index:200; background-image: url(./images/cell.png); width: 170px; height: 207px;}
	.backstep_button { cursor: pointer; float: right; background-image: url(./images/backstep_button.png); width: 93px; height: 26px; margin-right: 10px; cursor: pointer;}
	.step_option { float:left; border:1px solid #000; padding:10px; width:670px; margin:10px 0;}
	.payment_img { margin-right:4px;}
	
	#step1 { padding:0; border:none;}
	#step1_title { width:166px; height:27px; background-image: url(./images/step1_title.png); }
	#step1_content { float:left; width: 648px; height:70px; padding-top: 10px; padding-left: 100px; border:1px solid #e1e1e1;}
	
	#step2 {border:none;}
	#step2_title { width:149px; height:26px; background-image: url(./images/step2_title.png); }
	#step2_wrap  { float:left; border:1px solid #e1e1e1; }
	#step2_option {width:750px; height:28px; padding: 0px; background-image: url(./images/step2_option.png); background-repeat: no-repeat; background-position: center center; border:none; padding-top: 7px;}
	#step2_option_payment_card { cursor:pointer; margin-left: 50px; float:left;}
	#step2_option_payment_cash { cursor:pointer; margin-left: 150px; float:left;}
	#step2_option_order { float:right; margin: 0 40px;}
	.restaurant_cell { background-image: url(./images/restaurant_cell.png); width:134px; height: 215px;float:left; border:none; cursor: pointer;  margin:0 3px; margin-bottom: 10px; }
	.step2_page_button { cursor: pointer; width:17px; height:23px; margin-top: 100px; }
	#step2_prev_button { float: left; background-image: url(./images/prev_button.png); margin-right: 3px; margin-left: 7px;}
	#step2_next_button { float: left; background-image: url(./images/next_button.png); }
	#step2_content { float: left; width: 700px; height:220px;}
	#step2_page {float:left; width:750px; text-align:center; margin-bottom: 10px; }

	#step3_title { width: 135px; height: 26px; background-image: url(./images/step3_title.png); }
	#step3_wrap  { float:left; border:1px solid #e1e1e1; }
	#step3_option { width:750px; height: 35px; padding:0px; background-image: url(./images/step3_option.png); background-repeat: no-repeat; background-position: center center; border: none; padding-top: 16px;}
	#step3_option_order { float:right; margin: 0 40px;}
	.step3_page_button { cursor: pointer; width:17px; height:23px; margin-top: 206px; }
	#step3_content { float: left; width: 710px; height:440px;}
	.nextstep_button_3 { float: right; width:93px; height: 26px; background-image: url(./images/nextstep_button.png); margin-right: 10px; cursor: pointer;}
	#step3_prev_button { float: left; background-image: url(./images/prev_button.png); margin-right: 1px; margin-left: 2px;}
	#step3_next_button { float: left; background-image: url(./images/next_button.png); }
	#step3_page {float:left; width:750px; text-align:center; margin-bottom: 10px;}

	#step4_wrap  { float:left; border:1px solid #e1e1e1; padding:10px; background-image: url(./images/step4_background_1.png); background-repeat: no-repeat; width:730px;}
	#step4_title { width: 147px; height: 25px; background-image: url(./images/step4_title.png); }
	.nextstep_button_4 { float: right; width:93px; height: 26px; background-image: url(./images/nextstep_button.png); margin-right: 10px; cursor: pointer;}
	#nextstep_button_44 { float: left; width:61px; height: 33px; margin-left: 10px; margin-top: 4px; cursor: pointer;}
	.address_button { width: 80px; height: 21px; /*background-image: url(./images/nonselected_tab.png);*/  text-align: center; padding-top:8px;}
	#step4_option {border:none; padding:0; margin:0;}
	#step4_content {text-align: center;}

	.address_button { float:left; cursor: pointer; margin: 0 3px; }
	#address_value { float: left; margin-left:10px; margin-top: 10px;}
	
	#step5 { padding:0; border:none;}
	#step5_title {width: 163px; height: 25px; background-image: url(./images/step5_title.png);}
	#step5_confirm { float:right; width:200px; cursor: pointer;}
	#step5_retry { float:right; width:200px; margin-right: 165px; cursor: pointer;}
	#step5_option { border:1px solid #e1e1e1; width: 700px; }
	#step5_wrap  { float:left; border:1px solid #e1e1e1; padding:10px;}
	
	.step5_option_title { width:695px; height:27px; background-image: url(./images/step5_rest_title.png); padding-left:8px; font-size: 14px; color: #37bbed; vertical-align: top; padding-top:7px; float:left;}
	.step5_option_title div {float:left;}
	
	.step5_option_homeicon {background:url(layouts/yamnyam_layout/images/home_icon.png); width:18px; height:16px; margin-top:2px;}
	.step5_option_paymentimg {background:url(layouts/yamnyam_layout/images/select_payment_title.png); width:151px; height:23px;}
	.step5_table { width:332px; }
	.step5_table th { border-top:2px solid #e1e1e1; border-bottom:2px solid #e1e1e1; background-color: #fcfcfc;}
	.step5_table td { text-align: center;}
	
	.step5_lefttable { float:left; margin-top: 15px;}
	.step5_righttable { float:right; margin-top: 15px;}
	
	.payment_button { float:right; margin-left:10px;}
	
	.wizard_social_text {font-size: 18px; padding:5px 5px; height:44px;}
</style>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

<script type="text/javascript" charset="utf-8">
	var minimumPrice = new Object();
	var payment = new Object();

	var staticArgs=0;
	var staticPayment=0;
	var staticOrder=0;
	var present_step=1;
	
	var step2_staticPage=0;
	var step3_staticPage=0;
	var totalPage=0;

	function getStrCuts(str, max) {
		ns = str.substr(0,max);
		if(ns.length != str.length) {
			ns = ns + "...";
		}
		return ns;
	}

    function getImagePriceSmall(price) {
    	var preAddress = "./modules/board/skins/yamnyam_foodlist/images/";
        	
    	var priceCount = price.length;
    	
    	var result="";
    	
        result += "<div><div style='border-bottom:2px solid red; position:relative; top:10px; left:65px; width:80px;'></div>";
    	
		result += "<div style='background-image:url"+"("+preAddress+"s_won_1.png); width:13px; height:20px; float:right;'></div>";

		var i=0;

		for(i=0; i!=priceCount; i++) {
			if (i==3) {
				result += ("<div style='background-image:url"+"("+preAddress+"s_comma.png); width:8px; height:20px; margin:0 -1px 0 -2px; float:right;'></div>");
			}

		
			if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 0 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"s_0.png); width:13px; height:20px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 1 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"s_1.png); width:9px; height:20px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 2 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"s_2.png); width:13px; height:20px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 3 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"s_3.png); width:13px; height:20px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 4 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"s_4.png); width:13px; height:20px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 5 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"s_5.png); width:12px; height:20px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 6 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"s_6.png); width:13px; height:20px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 7 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"s_7.png); width:13px; height:20px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 8 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"s_8.png); width:13px; height:20px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 9 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"s_9.png); width:13px; height:20px; float:right;'></div>");
			}				
		}
		
		result += "</div>";
		
    	return result;
    }

    function getImagePrice(price) {
    	var preAddress = "./modules/board/skins/yamnyam_foodlist/images/";
        	
    	var priceCount = price.length;
    	
    	var result="";
    	
		result += "<div style='background-image:url"+"("+preAddress+"won_1.png); width:19px; height:30px; float:right;'></div>";

		var i=0;

		for(i=0; i!=priceCount; i++) {
			if (i==3) {
				result += ("<div style='background-image:url"+"("+preAddress+"comma.png); width:12px; height:30px; margin:0 -1px 0 -2px; float:right;'></div>");
			}

		
			if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 0 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"0.png); width:19px; height:30px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 1 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"1.png); width:13px; height:30px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 2 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"2.png); width:19px; height:30px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 3 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"3.png); width:19px; height:30px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 4 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"4.png); width:19px; height:30px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 5 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"5.png); width:18px; height:30px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 6 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"6.png); width:19px; height:30px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 7 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"7.png); width:19px; height:30px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 8 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"8.png); width:19px; height:30px; float:right;'></div>");
			}
			else if (Math.floor( ( price%Math.pow(10,i+1) ) /Math.pow(10,i)) == 9 ) {
				result += ("<div style='background-image:url"+"("+preAddress+"9.png); width:19px; height:30px; float:right;'></div>");
			}				
		}
    	return result;
    }
	
	
	function forCart() {
		$(".cell").mouseover(function() {
			$(this).css("border","2px #ccc solid");
		});
		$(".cell").mouseout(function() {
			$(this).css("border","2px white solid");
		});
			//주문을 위한 함수들
		$(".cell").dblclick(function() {
			var id = $(this).children('#id').val();
			var price = $(this).children('#price').val();
			var calorie = $(this).children('#calorie').val();
			var name = $(this).children('#name').val();
			var phone= $(this).children('#phone').val();
			var nickname= $(this).children('#nickname').val();
			
			toCart(id, price,calorie,name,phone,nickname);
		});
	    $('.cell_button').click(function() {
			var id = $(this).parent().children('#id').val();
			var price = $(this).parent().children('#price').val();
			var calorie = $(this).parent().children('#calorie').val();
			var name = $(this).parent().children('#name').val();
			var phone= $(this).parent().children('#phone').val();
			var nickname= $(this).parent().children('#nickname').val();
			
			toCart(id, price,calorie,name,phone,nickname);
		});
		$( ".cell" ).draggable({
			start: function() {
				var id = $(this).children('#id').val();
				var price = $(this).children('#price').val();
				var calorie = $(this).children('#calorie').val();
				var name = $(this).children('#name').val();
				var phone= $(this).children('#phone').val();
				var nickname= $(this).children('#nickname').val();
				
				copyVar(id, price, calorie, name, phone, nickname);

				var temp_top = $('#divCart').css("margin-top");
				temp_top = parseInt(temp_top.substring(0, temp_top.length-2));
				$('#divCart').css("margin-top",temp_top-1);
				$('#divCart').css("margin-right","7px");
				$('#divCart').css("border","2px #cc5555 solid");
				
				$('#droptheitem').css("visibility","visible");
			},
			helper: function() {
				return $(this).clone();	
			},
			stop: function() {
				$('#divCart').css("border","1px solid #b8b8b8");
				$('#divCart').css("margin-right","8px");

				var temp_top = $('#divCart').css("margin-top");
				temp_top = parseInt(temp_top.substring(0, temp_top.length-2));
				$('#divCart').css("margin-top",temp_top+1);
				
				$('#droptheitem').css("visibility","hidden");
			}
		});
	}

	$(document).ready(function() {
	
		// category img 마우스 오버시 변경
		$('.category_img').mouseover(function() {
			var file = $(this).attr('src');
			$(this).attr('src', file.replace('_gray.png','.png'));
		});
		$('.category_img').mouseout(function(){
			var file = $(this).attr('src');
			$(this).attr('src', file.replace('.png','_gray.png'));
		});
		
		var step2_payment=0;
		// step2 결제방식 이미지 변경
		$('.step2_payment_img').click(function() {
			var file = $(this).attr('src');
			$(this).attr('src', file.replace('_gray.png','.png'));
		});
	
		// 지도 초기화
		var marker;
		var geocoder = new google.maps.Geocoder();
		var infowindow = new google.maps.InfoWindow();
		
		var logged_address_0 = '{$logged_info->address[0]}';
		var logged_address_1 = '{$logged_info->address[1]}';
					
		var for_splite_char_index = logged_address_0.indexOf("(");

		logged_address_0 = logged_address_0.substring(0,for_splite_char_index)
		var logged_address = logged_address_0.concat(logged_address_1);

		$('#address_value').attr('value',logged_address);
		
		var latlng = new google.maps.LatLng(37.29355, 126.974208);
		var myOptions = {
			zoom: 16,
			center: latlng,
			mapTypeId: google.maps.MapTypeId.ROADMAP,
			scrollwheel: false
		};
		var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
					
        marker = new google.maps.Marker({
            map: map, 
            position: latlng
        });
					
		if(logged_address) {
		    geocoder.geocode( { 'address': logged_address}, function(results, status) {
		      if (status == google.maps.GeocoderStatus.OK) {
		        map.setCenter(results[0].geometry.location);
		        marker = new google.maps.Marker({
		            map: map, 
		            position: results[0].geometry.location
		        });
		        
				$('.text').each(function(j) {
					if ($(this).attr('name')=='extra_vars11') {
						$(this).attr({value:results[0].geometry.location.lat()});
					}
					if ($(this).attr('name')=='extra_vars12') {
						$(this).attr({value:results[0].geometry.location.lng()});
					}
					if ($(this).attr('name')=='extra_vars13') {
						$(this).attr({value:logged_address});
					}
				});
		      } else {
		        alert("Geocode was not successful for the following reason: " + status);
		      }
		    });
		}
		
		google.maps.event.addListener(map, 'click', function(event) {

			if($('#address_value').attr('readonly')==false) {

				map.setCenter(event.latLng);
		
				var latlng1 = new google.maps.LatLng(event.latLng.lat(), event.latLng.lng());
			
			    if (geocoder) {
					geocoder.geocode( { 'latLng': latlng1}, function(results, status) {
						if (status == google.maps.GeocoderStatus.OK) {
					        if (results[0]) {
								map.setZoom16;
								marker.setMap();
			
								marker = new google.maps.Marker({
					            	position: latlng1, 
									map: map
								});
										
								$('#address_value').attr('value',results[0].formatted_address);
							} else {
								alert("No results found");
					        }
							} else {
					        alert("Geocoder failed due to: " + status);
						}
					});
				}
			}
		});
				
		// 초기화
		$('#step2').animate({
		    opacity: 0.4}, 0
		);
		$('#step3').animate({
		    opacity: 0.4}, 0
		);
		$('#step4').animate({
		    opacity: 0.4}, 0
		);
		$('#step5').animate({
		    opacity: 0.4}, 0
		);

		// 주문하기 버튼
		$('#step5_confirm').click(
			function() {
				<!--@if(!$is_logged)-->

				<!--@else-->
					if (checkform()) {
						document.divCartForm.submit();				
					}
				<!--@end-->
			}
		);

		// step2 prev_button
		$('#step2_prev_button').click(
			function() {
				if(step2_staticPage>0)
					step2_staticPage--;
				//alert(staticPage);
				getContents(2, staticArgs, staticPayment, staticOrder, 1, 0);
			}
		);
		
		// step2 next_button
		$('#step2_next_button').click(
			function() {
				if(step2_staticPage<totalPage)
					step2_staticPage++;
				//alert(totalPage+" "+staticPage);
				getContents(2, staticArgs, staticPayment, staticOrder, 1, 0);
			}
		);
		
		// step3 prev_button
		$('#step3_prev_button').click(
			function() {
				if(step3_staticPage>0)
					step3_staticPage--;
				//alert(staticPage);
				getContents(3, staticArgs, staticPayment, staticOrder, 0, 0);
			}
		);
		
		// step3 next_button
		$('#step3_next_button').click(
			function() {
				if(step3_staticPage<totalPage)
					step3_staticPage++;
				//alert(totalPage+" "+staticPage);
				getContents(3, staticArgs, staticPayment, staticOrder, 0, 0);
			}
		);

		// 2단계에서 1단계로 뒤로가기 버튼
		$('#backstep_button_2').click(
			function() {
				moveToPreStep(2);
				$('#step2'+'_content').empty();
				$('#step2').animate({
				    opacity: 0.4}, 0
				);
			}
		);

		// 3단계에서 2단계로 뒤로가기 버튼		
		$('.backstep_button_3').click(
			function() {
				moveToPreStep(3);
				$('#step3'+'_content').empty();
				$('#step3').animate({
				    opacity: 0.4}, 0
				);
			}
		);
		
		// 4단계에서 3단계로 뒤로가기 버튼		
		$('.backstep_button_4').click(
			function() {
				moveToPreStep(4);
				$('#step4').animate({
				    opacity: 0.4}, 0
				);
			}
		);
		
		// 5단계에서 4단계로 뒤로가기 버튼		
		$('#backstep_button_5').click(
			function() {
				moveToPreStep(5);
				$('#step5').animate({
				    opacity: 0.4}, 0
				);
			}
		);
		
		// 3단계에서 4단계로 넘어가기 버튼
		$('.nextstep_button_3').click(
			function() {
				moveToNextStep(3);
				$('#step4').animate({
				    opacity: 1.0}, 1000
				);

    		    $('#address_value').attr('readonly', 'readonly');
			}
		);
		
		// 4단계에서 5단계로 넘어가기 버튼
		$('.nextstep_button_4').click(
			function() {
				moveToNextStep(4);
				$('#step5').animate({
				    opacity: 1.0}, 1000
				);
			}
		);
		// 4단계에서 5단계로 넘어가기 버튼
		$('#nextstep_button_44').click(
			function() {
				moveToNextStep(4);
				$('#step5').animate({
				    opacity: 1.0}, 1000
				);
			}
		);
		
		//5단계에서 1단계로 넘어가기 버튼
		$('#step5_retry').click(
			function(){
				window.scrollTo(0,$('#step1').position().top-5);
				$('#step2'+'_content').empty();
				$('#step2').animate({
				    opacity: 0.4}, 0
				);
				$('#step3'+'_content').empty();
				$('#step3').animate({
				    opacity: 0.4}, 0
				);
				$('#step4'+'_content').empty();
				$('#step4').animate({
				    opacity: 0.4}, 0
				);
				$('#step5').animate({
				    opacity: 0.4}, 0
				);
			}	
		);

		//현금 카드에 따른 xml 요청
		$('#step2_option_payment_card').click(function() {		

			$('#step2_option_payment_card').attr('src', '/wizard/images/step2_payment_card_on.png');
			$('#step2_option_payment_cash').attr('src', '/wizard/images/step2_payment_cash.png');

			staticPayment = 2;
		    getContents(2, staticArgs, staticPayment, staticOrder, 1, 1);
		});
		
		$('#step2_option_payment_cash').click(function() {
		
			$('#step2_option_payment_card').attr('src', '/wizard/images/step2_payment_card.png');
			$('#step2_option_payment_cash').attr('src', '/wizard/images/step2_payment_cash_on.png');
		
			staticPayment = 1;
		    getContents(2, staticArgs, staticPayment, staticOrder, 1, 1);
		});
		
		//기본주소입력
		$('#address_button_1').click(
			function() {
    		    $('#address_value').attr('value','{$logged_info->address[1]}');
    		    $('#address_value').attr('readonly', 'readonly');
    		    $('#step4_wrap').css("background-image", "url(./images/step4_background_1.png)");
			}
		);
		//마지막배송지주소입력
		$('#address_button_2').click(
			function() {
				var ordered_address = '{$logged_info->recentaddress}';
				var recent_address = ordered_address.split('|');
				
    		    $('#address_value').attr('value',recent_address[0]);
    		    $('#address_value').attr('readonly', 'readonly');
    		    $('#step4_wrap').css("background-image", "url(./images/step4_background_2.png)");
			}
		);
		//새주소입력
		$('#address_button_3').click(
			function() {
    		    $('#address_value').attr('value', '');
    		    $('#address_value').attr('readonly', '');
    		    $('#step4_wrap').css("background-image", "url(./images/step4_background_3.png)");
			}
		);
	});
	
	function moveToNextStep(present_step) {
		window.scrollTo(0,$('#step'+(present_step+1)).position().top-5);
	}
	
	function moveToPreStep(present_step) {
		window.scrollTo(0,$('#step'+(present_step-1)).position().top-5);
	}

	//전송받은 xml을 알맞게 출력
    function addmsg(type, step, msg){

		$('#step3_content').empty();
		
		totalPage = $(msg).find("totalPage").text();

    	if(type=='new') {
	    	if(step==1) {
				$('#step'+step).show();
			}
	    	else if(step==2) {
		    	present_step = 2;
		    	
	    		var msgStr = "";

				$(msg).find("item").each(function () {
					//var self = this;
					
					var payment_img = "";
					
					if ($(this).find("paymentMethod").text()=="현금") {
						payment_img += "<img src='./images/big_cash.png' class='payment_img'/>";
					}
					else if ($(this).find("paymentMethod").text()=="카드") {
						payment_img += "<img src='./images/big_card.png' class='payment_img'/>";
					}
					else if ($(this).find("paymentMethod").text()=="현금|@|카드") {
						payment_img += "<img src='./images/big_cash.png' class='payment_img'/>";
						payment_img += "<img src='./images/big_card.png' class='payment_img'/>";
					}
					
					msgStr += "<div class='restaurant_cell' onClick='getContents(3, "+$(this).find("member_srl").text()+", 0, 0, 1, 0); moveToNextStep(2); return false;'>";
					msgStr += "<div style='text-align:center; color:#fff; font-size:16px; font-weight:bold; margin-top:4px;'>" + getStrCuts($(this).find("title").text(), 5)+"</div>";
					msgStr += "<div style='width:114px; height:83px; background-image:url"+"("+$(this).find("uploaded_filename").text()+"); background-size:114px 83px; margin-left:10px; margin-top:12px;'></div>";
					
					msgStr += "<div style='font-size:12px;width:110px; margin-top:4px; margin-left:11px;'>최소배달금액</div>";
					msgStr += "<div style='font-size:12px;width:110px; margin-left:11px;text-align:right;'>"+$(this).find("minimumPriceStr").text()+"원</div>";
					msgStr += "<div style='font-size:12px;width:110px; margin-left:11px;'>영업시간</div>";
					msgStr += "<div style='font-size:12px;width:110px; margin-left:11px;text-align:right;'>"+$(this).find("opentime").text()+"~"+$(this).find("closetime").text() + "</div>";
					msgStr += "<div style='font-size:12px;width:110px; margin-left:11px;'><div style='float:left; margin-top:5px;'>결제방식</div>&nbsp;&nbsp;&nbsp;"+ payment_img +"</div></div>";
				});

				//하단 페이지 출력
				var pageStr = "";
				for(var temp_i=1; temp_i<=$(msg).find("printTotalPage").text(); temp_i++) {
					if (temp_i==$(msg).find("printCurrentPage").text()) {
						pageStr += " <a style='color:#3b90d1;'>"+temp_i+"</a> ";
					}
					else {
						pageStr += " <a style='color:#707070;'>"+temp_i+"</a> ";
					}
				}
				$('#step'+step+'_content').empty();
				$('#step'+step+'_content').append(msgStr);
				$('#step'+step+'_page').empty();
				$('#step'+step+'_page').append(pageStr);
				$('#step'+step).animate({
				    opacity: 1.0}, 1000
				);
			}
	    	else if(step==3) {
	    		present_step = 3;
	    		
	    		var msgStr = "";

				$(msg).find("item").each(function () {
	    				//"<div>"+$(this).find("priceStr").text()+"원</div>"
				
	    			msgStr += "<div class='cell'>";
	    			msgStr += "<div style='width:150px; height:110px; background-image:url"+"("+$(this).find("uploaded_filename").text()+"); background-size:150px 110px; margin-left:9px;margin-top:32px;'>";


					msgStr += "<div class='wizard_social_text'>";
					if($(this).find("social_date").text()!="" && $(this).find("social_to").text()!="") {
						var social_date = $(this).find("social_date").text();
						var social_month = social_date[4]+social_date[5];
						var social_day = social_date[6]+social_date[7];
						msgStr += "<div><b>"+social_month+"월 "+social_day+"일</b><a>까지</a></div>";
						msgStr += "<div style='float:right;'><b>"+$(this).find("social_to").text()+"명</b><a>이면</a></div>";
					}
					msgStr += "</div>";
	    			msgStr += "<div style='padding-top:0px; margin-right:7px; height:20px;'>";
	    			if ($(this).find("pre_price").text()) {
		    			msgStr +=  getImagePriceSmall($(this).find("pre_price").text());
	    			}
	    			msgStr += "</div>";
	    			msgStr += "<div style='padding-top:5px; margin-right:5px; height:30px;'>"+getImagePrice($(this).find("price").text())+"</div>";
	    			msgStr += "</div>";
	    			msgStr += "<div style='font-size:14px; color:#909090; font-weight:bold; margin-top:6px; text-align:center;'>"+getStrCuts($(this).find("title").text(), 9)+"</div>";
	    			msgStr += "<div style='padding-top:10px; width:20px; float:left; padding-left:1px;'>";
					msgStr += "</div>";
	    			msgStr += "<div class='cell_button' style='width:128px; height:32px; margin-top:10px; margin-left:41px;'></div>";
					msgStr += "<input type='hidden' id='id' value='"+$(this).find("document_srl").text()+"'>";
					msgStr += "<input type='hidden' id='price' value='"+$(this).find("price").text()+"'>";
					msgStr += "<input type='hidden' id='calorie' value='"+$(this).find("calorie").text()+"'>";
					msgStr += "<input type='hidden' id='name' value='"+$(this).find("title").text()+"'>";
					msgStr += "<input type='hidden' id='phone' value='"+$(this).find("cellphone").text()+"'>";
					msgStr += "<input type='hidden' id='nickname' value='"+$(this).find("nick_name").text()+"'>";
	    			msgStr += "</div>";
				});

				//하단 페이지 출력
				var pageStr = "";
				for(var temp_i=1; temp_i<=$(msg).find("printTotalPage").text(); temp_i++) {
					if (temp_i==$(msg).find("printCurrentPage").text()) {
						pageStr += " <a style='color:#3b90d1;'>"+temp_i+"</a> ";
					}
					else {
						pageStr += " <a style='color:#707070;'>"+temp_i+"</a> ";
					}
				}

				$('#step'+step+'_content').empty();
				$('#step'+step+'_content').append(msgStr);
				$('#step'+step+'_page').empty();
				$('#step'+step+'_page').append(pageStr);
				forCart();
				$('#step'+step).animate({
				    opacity: 1.0}, 1000
				);
			}
	    	else {
				$('#step'+step+'_content').empty();
				$('#step'+step+'_content').append('다시 시도하시기 바랍니다.');
	    	}
	    }
	}

	// xml을 요청
    function getContents(step, args, payment, order, page3, page2){
    	if(args==0) {
    		var urlStr = "/wizard/wizard_process.php?step="+step;
    	}
    	else {
	    	staticArgs=args;
    		var urlStr = "/wizard/wizard_process.php?step="+step+"&args="+args;    	
    	}
    	
    	if(page3==1) {
    		step3_staticPage = 0;
    		urlStr += ("&page3="+step3_staticPage);
    	} else {
    		urlStr += ("&page3="+step3_staticPage);
    	}
    	
    	if(page2==1) {
    		step2_staticPage = 0;
    		urlStr += ("&page2="+step2_staticPage);
    	} else {
    		urlStr += ("&page2="+step2_staticPage);
    	}
    	
    	if(payment!=0) {
    		urlStr += ("&payment="+payment);
    	}
    	
    	urlStr += ("&order="+order);
    	
        $.ajax({
            type: "GET",
            url: urlStr, 

            async: true,
            cache: false,
            timeout:50000,

            success: function(data) {
            	console.log(data);
            	//alert(data);
                addmsg("new", step, data);
            },
            error: function(XMLHttpRequest, textStatus, errorThrown){
                addmsg("error", step, textStatus + " (" + errorThrown + ")");
            }
        });
    };
    
    $(document).ready(function(){
        getContents(1, 0, 0, 0, 1, 1);
    });
</script>


{@ // 상점의 이름으로부터 상점이 설정한 최소값을 구한다.
	$oDB = &DB::getInstance();
	$result = $oDB->_query("SELECT nick_name FROM yman_documents where module_srl = 141;");
	$output = $oDB->_fetch($result);
	$nickname = (array)$output;
}
<!--@for($i=0;$i<count($nickname);$i++)-->
	{@
	$result = $oDB->_query("SELECT value from yman_document_extra_vars where document_srl = (SELECT document_srl FROM yman_documents where nick_name = '".$nickname[$i]->nick_name."' and module_srl = 141 limit 1) and var_idx=1 limit 1;");
	
	$output = $oDB->_fetch($result);
	
	$temp = (array)$output;
	
	// 상점의 이름으로부터 상점 결제방법을 구한다.
	$result = $oDB->_query("SELECT value from yman_document_extra_vars where document_srl = (SELECT document_srl FROM yman_documents where nick_name = '".$nickname[$i]->nick_name."' and module_srl = 141 limit 1) and var_idx=3 limit 1;");
	
	$output = $oDB->_fetch($result);
	
	$payment = (array)$output;
	}
	<script type="text/javascript">
		// <![CDATA[
		minimumPrice['{$nickname[$i]->nick_name}']={$temp[value]};
		payment['{$nickname[$i]->nick_name}']="{$payment[value]}";
		// ]]>
	</script>
<!--@end-->

<div id="divWizardList">
	<div id="step1" class="step">
		<div id="step1_title" class="step_title"></div>
		<div id="step1_content" class="step_content">
	    		<div class='category' onClick='getContents(2, 0, 0, 0, 1, 1); moveToNextStep(1); return false;'><img src='./images/button_category_0_gray.png' class='category_img'/></div>
	    		<div class='category' onClick='getContents(2, 199, 0, 0, 1, 1); moveToNextStep(1); return false;'><img src='./images/button_category_1_gray.png' class='category_img'/></div>
	    		<div class='category' onClick='getContents(2, 201, 0, 0, 1, 1); moveToNextStep(1); return false;'><img src='./images/button_category_2_gray.png' class='category_img'/></div>
	    		<div class='category' onClick='getContents(2, 203, 0, 0, 1, 1); moveToNextStep(1); return false;'><img src='./images/button_category_3_gray.png' class='category_img'/></div>
	    		<div class='category' onClick='getContents(2, 205, 0, 0, 1, 1); moveToNextStep(1); return false;'><img src='./images/button_category_4_gray.png' class='category_img'/></div>
	    		<div class='category' onClick='getContents(2, 207, 0, 0, 1, 1); moveToNextStep(1); return false;'><img src='./images/button_category_5_gray.png' class='category_img'/></div>
	    		<div class='category' onClick='getContents(2, 2921, 0, 0, 1, 1); moveToNextStep(1); return false;'><img src='./images/button_category_6_gray.png' class='category_img'/></div>
	    		<div class='category' onClick='getContents(2, 2923, 0, 0, 1, 1); moveToNextStep(1); return false;'><img src='./images/button_category_7_gray.png' class='category_img'/></div>
	    		<div class='category' onClick='getContents(2, 2927, 0, 0, 1, 1); moveToNextStep(1); return false;'><img src='./images/button_category_8_gray.png' class='category_img'/></div>
	    		<div class='category' onClick='getContents(2, 2925, 0, 0, 1, 1); moveToNextStep(1); return false;'><img src='./images/button_category_10_gray.png' class='category_img'/></div>
		</div>
	</div>
	<div id="step2" class="step">
		<div id="step2_title" class="step_title"></div>
		<div id='backstep_button_2' class='backstep_button'></div>
		<div id="step2_wrap">
			<div id="step2_option" class="step_option">
				<img src='./images/step2_payment_cash.png' id="step2_option_payment_cash"/>
				<img src='./images/step2_payment_card.png' id="step2_option_payment_card"/>
				<select id="step2_option_order" onchange="getContents(2, staticArgs, staticPayment, this.value, 1, 1)">
					<option value="0">랜덤순</option>
					<option value="1">이름순</option>
					<option value="2">최소가격순</option>
				</select>		
			</div>
			<div id="step2_prev_button" class='step2_page_button'></div>
			<div id="step2_content" class="step_content"></div>
			<div id="step2_next_button" class='step2_page_button'></div>	
			<div id="step2_page"></div>
		</div>
	</div>
	<div id="step3" class="step">	
		<div id="step3_title" class="step_title"></div>
		<div class='nextstep_button_3'></div>	
		<div class='backstep_button backstep_button_3'></div>
		<div id="step3_wrap">
			<div id="step3_option" class="step_option">
				<select id="step3_option_order" onchange="getContents(3, staticArgs, staticPayment, this.value, 1, 0)">
					<option value="0">랜덤순</option>
					<option value="1">이름순</option>
					<option value="2">가격순</option>
				</select>
			</div>
			<div id="step3_prev_button" class='step3_page_button'></div>
			<div id="step3_content" class="step_content"></div>
			<div id="step3_next_button" class='step3_page_button'></div>
			<div id="step3_page"></div>
			<div class='nextstep_button_3' style='margin-top:-20px; margin-bottom:10px;'></div>
		</div>
	</div>
	<div id="step4" class="step">	
		<div id="step4_title" class="step_title"></div>
		<div class='nextstep_button_4'></div>
		<div class='backstep_button backstep_button_4'></div>
		<div id="step4_wrap">
			<div id="step4_option" class="step_option">
				<div id="address_button_1" class="address_button"></div>
				<div id="address_button_2" class="address_button"></div>
				<div id="address_button_3" class="address_button"></div>
			</div>
			<div id="step4_content" class="step_content">
				<input type="text" name="address_value" id="address_value" size="80" readonly="readonly"/>
				<img src='./images/address_confirm.png' id='nextstep_button_44'/>
				<div class="map_body" style="margin-top:60px;">
					<div id="map_canvas" style="width:680px; height:400px; margin:30px 24px;"></div>
				</div>
			</div>
		</div>
	</div>
	<div id="step5" class="step">	
		<div id="step5_title" class="step_title"></div>
		<div id='backstep_button_5' class='backstep_button'></div>
		<div id="step5_wrap">
			<div id="step5_option" class="step_option"></div>
	
			<!--@if(!$is_logged)-->
			<div id="step5_confirm">
				<a class="buttonLogin2" href="./" onclick="return alerting()"><img src="../layouts/yamnyam_layout/images/button_bill.png"/></a>
				<a class="buttonLogin2" href="./" onclick="return alerting()"<img src="../layouts/yamnyam_layout/images/more_button.png">
			</div>
			<!--@else-->
			<div id="step5_retry">
				<img src="./images/more_button.png"/>
			</div>
			<div id="step5_confirm">
				<img src="../layouts/yamnyam_layout/images/button_bill.png"/>
			</div>		
			<!--@endif-->
		</div>
	</div>
</div>